import Vue from "vue";
import App from "./App.vue";

function setRemUnit() {
  const docEl = document.documentElement;
  const clientWidth = docEl.clientWidth;
  if (!clientWidth) return;

  const designWidth = 1920; // 设计稿真实宽度
  const fontSize = (clientWidth / designWidth) * 75; // 计算根元素字体大小
  docEl.style.fontSize = fontSize + "px";
}

setRemUnit();

window.addEventListener("resize", setRemUnit);
window.addEventListener("pageshow", function(e) {
  if (e.persisted) {
    setRemUnit();
  }
});

new Vue({
  render: (h) => h(App),
}).$mount("#app");
